<?
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
date_default_timezone_set('Asia/Ho_Chi_Minh');
$dbhost="localhost";
$dbuser="root";
$dbpass="";
$dbname="sonkimlam";
$datatype="mysqli";
$baselink="http://localhost/sonkimlam"; //không có dấu / cuối cùng. nếu domain trực tiếp thì để trống
$serverimg="http://sv1.tocvasao.net";
$fb_appid="271766339675994"; //ID APP Facebook quản lý comment.
$timeLoadOnline=10; //thời gian load lại lượt người online tính theo phút
define('baselink', $baselink,true);
define('serverimg', $serverimg,true);
define('base_admin', baselink."/admin/",true);
define('base_includes', baselink."/includes/",true);
define('base_aincludes', base_admin."/includes/",true);
define('FB_APPID', $fb_appid,true);
define('base_popup', "http://sv1.tocvasao.net/ckfinderhaihipngochip/popup.php?hash=fd3f1c37bed485936f8b585da01dd73052528480faa8814bc30ea2e6360fa246eef995fcc7aa80f941f7d41bf3c29ddc7bfad6b57b63e376afeb1cecc4941720f0c855f66a689e6d166cc1353b034d72",true);
$config["ip_serverSMS"]="123.29.69.182";
$config["sms"]=array(
"000" => array("code" =>"000", "message" => "Binh chon thanh cong", "status" => "true"),
"001" => array("code" =>"001", "message" => "chua den hoac het thoi gian binh chon", "status" => "false"),
"002" => array("code" =>"002", "message" => "Sai ma so bai thi", "status" =>"false"),
"003" => array("code" =>"003", "message" => "Loi he thong", "status" =>"false"),
);
if($_GET['getconfig']=="js")
{
	header('Content-Type: application/javascript');
	echo 'CKEDITOR.config.baselink = "'.$baselink.'";';
	echo 'filebrowserBrowseUrl = "'.base_popup.'"';
}

$rootdir =str_replace("\\","/",__DIR__);
$rootdir =str_replace("includes","",$rootdir);
$upload=$rootdir.'upload/';
$uploadPathAtt='attachment/';
$uploadPathImg='images/';

function upload_file($file,$type)
{
	global $upload;
	global $uploadPathAtt;
	global $uploadPathImg;
	$uploadPath="";
	if($type==1)
	{
		$uploadPath=$uploadPathAtt;
	}
	else
	{
		$uploadPath=$uploadPathImg;
	}
	$path=$uploadPath.md5(rand(0,1000000).time().md5(rand(0,1000000)))."_".$file["name"];
	while(file_exists($upload.$path))
	{
		$path=$uploadPath.md5(rand(0,1000000).time().md5(rand(0,1000000)))."_".$file["name"];
	}
	$ret=move_uploaded_file($file["tmp_name"], $upload.$path);
	if($ret)
	{
		return $path;
	}else
		return false;
}
?>